module two {
	export class JewelryLoadingPage extends BaseComponent {
		public constructor() {
			super("JewelryLoadingPage");
		}
		public txt_progress: eui.Label;
		public bar: eui.ProgressBar;
		public bar_star: eui.Image;

		startLoad(jewId: string): void {
			let jewCfg = JewelryConfig.getConfigById(jewId);
			let starCfg = StarConfig.getConfigById(jewCfg.star);

			let keys: string[] = [];
			for (let i = 1; i <= jewCfg.count[0]; i++) {
				keys.push(jewCfg.star + "_open_" + jewCfg.icon + "_" + i + "_jpg");
			}
			RES.createGroup("tempOpenGroup", keys, true);
			let loads = ["tempOpenGroup"];

			this.bar.value = 0;
			this.bar_star.x = 0;
			one.loaderManager.loadGroups(loads, 100, (current: number, total: number) => {
				this.txt_progress.text = `${current}/${total}`;
				this.bar.value = Math.floor(current / total * 100);
				this.bar_star.x = Math.floor(current / total * this.bar.width);

				if (current == total) {
					let page = two.changePage("share") as SharePage;
					page.resetJewelry(jewId);
				}
			})
		}

		protected created(): void {
			super.created();
		}
	}

	two.setClassMap("loading_jewelry", "two.JewelryLoadingPage");
}